package cn.sccl.common.model;

import cn.sccl.common.exception.BusinessException;

/**
 * 数据库表 CACHE_LOG 的实体对象
 * Created by 杨浩宇 on 2016-02-25.
 */
public class CacheLog extends BaseModel {
    /**
     * 表名
     */
    public final static String TABLE_NAME = "cache_log";

    private java.lang.String cacheKey;//
    private java.lang.String remark;//
    private java.lang.String opFlag;//

    public java.lang.String getCacheKey() {
        return this.cacheKey;
    }

    public void setCacheKey(java.lang.String cacheKey) {
        this.cacheKey = cacheKey;
    }

    public java.lang.String getRemark() {
        return this.remark;
    }

    public void setRemark(java.lang.String remark) {
        this.remark = remark;
    }

    public java.lang.String getOpFlag() {
        return this.opFlag;
    }

    public void setOpFlag(java.lang.String opFlag) {
        this.opFlag = opFlag;
    }

    /**
     * clone一个对象。
     *
     * @param cls 需要克隆的对象类型，只能是当前类的子类
     * @param <T>
     * @return
     * @throws IllegalAccessException
     * @throws InstantiationException
     */
    public <T extends CacheLog> T clone(Class<T> cls) {
        try {
            T t = cls.newInstance();
            t.setId(this.getId());
            t.setCacheKey(this.getCacheKey());
            t.setRemark(this.getRemark());
            t.setCreateTime(this.getCreateTime());
            t.setUpdateTime(this.getUpdateTime());
            t.setDeleteFlag(this.isDeleteFlag());
            t.setOpFlag(this.getOpFlag());
            return t;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BusinessException("对象克隆失败，请克隆的目标对象是否具有无参的构造函数。", e.getCause());
        }
    }
}